<?php declare(strict_types=1);

namespace App\Bac\Controller;

use App\Bac\Model\Config;
use App\Abstract\Controller;
use Hyperf\Di\Annotation\Inject;

class ConfigController extends Controller
{
    #[Inject]
    protected Config $dbModel;

    public function map(): array
    {
        return $this->dbModel->map();
    }

    public function list(): array
    {
        return $this->dbModel->list($this->request->query());
    }

    public function create(): array
    {
        return $this->dbModel->saveRow($this->request->all());
    }

    public function update(int $id): array
    {
        return $this->dbModel->saveRow($this->request->all(), $id);
    }

    public function delete(int $id): array
    {
        return $this->dbModel->deleteRow($id);
    }

}